# -*- coding: UTF-8 -*-
"""
@Project :xlx-fastapi
@File    :admin_user_proto.py
@Author  :xlx-ali
@Date    :2024/06/24 09:26 星期一
"""

from typing import Optional

from pydantic import BaseModel, Field


class AdminUserLoginRequest(BaseModel):
    '''
    账号登录入参
    '''
    username: Optional[str] = Field(default="", description="登录账号", examples=["test"])
    password: Optional[str] = Field(default="", description="登录密码", examples=["test"])
    code: Optional[str] = Field(default="", description="验证码", examples=["test"])


class AdminUserListRequest(BaseModel):
    """
    用户列表入参
    """
    id: Optional[int] = Field(default="", description="用户ID", examples=["1"])
    username: Optional[str] = Field(default="", description="登录账号", examples=["test"])
    page: Optional[int] = Field(default=1, description="页", examples=["1"])
    pageSize: Optional[int] = Field(default=10, description="每页数量", examples=["10"])


class AdminUserDetailProto(BaseModel):
    """
    账号详情
    """
    id: int
    username: str
    password: str
    pwd_hash: str
    role_id: int
    addtime: int
    last_login_time: int
    last_login_ip: str
    last_login_ipaddress: str
    openid: str
    is_sc: int = Field(description="是否是销售 0 1")
    mobile: str
    status: int = Field(description="状态[1:正常;2:锁定]")
    customer_exceed: int = Field(description="销售客户总数上限[0:未达上限;1:已达上限]")
    avatar: str


class AdminUserListResponse(BaseModel):
    """
    用户列表出参
    """

    record_total: int = Field(default=0, description="总量")
    record_list: list[AdminUserDetailProto] = Field(default=[])


class AdminUserLoginResponse(BaseModel):
    '''
    账号登录出参
    '''
    status_code: int = Field(default=0, description="返回状态码")
    token: str = Field(default="", description="返回Token")
    admin_user_info: AdminUserDetailProto = Field(default=None, description="账号详情")
